program drop _all

/* THIS PROGRAM IMPLEMENTS TOBIT REGRESSIONS IN TABLE 5 (cols. 1-3); IC-STATA ver. 10.1.
   NOTE: All the source and results files are saved at single directory: C:\RESTAT\*/
    
program define GROWTH
clear all
set more off
set memory 80m
set matsize 800
use C:\RESTAT\data1.dta, replace
log using C:\RESTAT\Tab5_tobit.log, replace 
   
                       
                       tsset firm year
 
#delimit ;            
 

/* KEEP ONLY OBS W/ NON-MISSING REGRESSORS */
                   
                    keep if growth~=. & FG~=. & DG~=. & ageT~=. & sales~=. & AS~=. & ES~=. & FORdirect~=. &
                          intang~=. & ESgap~=. & gap~=. & solvency~=. ;

                                    
 
 
/* CREATE DUMMY=1 WHENEVER DOM ENTRY RATE>0 (ANALOGICALLY WITH FORentry var (=STATIC) */
                   

           /* gen OTHER_ENTRANTS1 */
                   display" GENERATE OTHER_ENTRANTS1 BY SUBTRACTING 1 IF THE FIRM IS OF AGE=1";
                   gen OTHER_ENTRANTS1=ENTRANTS1;
                   replace OTHER_ENTRANTS1=ENTRANTS1-1 if age==1; 
                   replace OTHER_ENTRANTS1=0 if OTHER_ENTRANTS1<0;
                

          /* gen dummy for DOMENTRY */
                    gen DOMENTRY=1 if  OTHER_ENTRANTS1>0;
                    replace DOMENTRY=0 if OTHER_ENTRANTS1==0;
                                                    
             

          /* gen firm level means */
                   
                    sort firm ;
                    by firm: egen avsales=mean(sales);
                    by firm: egen avsales2=mean(sales2);
                    by firm: egen avESgap=mean(ESgap);
                    by firm: egen avFG=mean(FG);        
                    by firm: egen avageT=mean(ageT);
                    by firm: egen avageT2=mean(ageT2);
                    by firm: egen avAS=mean(AS);
                    by firm: egen avES=mean(ES);
                    by firm: egen avFORdirect=mean(FORdirect);
                    by firm: egen avintang=mean(intang);
                    by firm: egen avgap=mean(gap);
                    by firm: egen avsolvency=mean(solvency);
                    
                 
                     
                    tsset firm year ;
                 



/* *********************************** TOBIT - Tab 5 (cols. 1-3)***************** */
/* 1: Tab 5, col. 1 */;

                 
                  xi:tobit growth FG STATIC DOMENTRY ageT ageT2 sales sales2 AS ES FORdirect intang gap ESgap 
                                    D89 solvency NO_FOR  year94-year00 i.primaryu*trend reg1-reg4 reg6-reg8                                   
                                    konkurz liquidate both OUT_BR                               
                                    avFG avageT avageT2 avsales avsales2 avAS avES avFORdirect avintang 
                                    avgap avESgap avsolvency,ll(-1);
                   

                  

             
/* 2: Tab 5, col. 2 */;

                
                  xi:tobit growth FG STATIC DG ageT ageT2 sales sales2 AS ES FORdirect intang gap ESgap 
                                    D89 solvency NO_FOR year94-year00 i.primaryu*trend reg1-reg4 reg6-reg8                                   
                                    konkurz liquidate both OUT_BR                                
                                    avFG avageT avageT2 avsales avsales2 avAS avES avFORdirect avintang 
                                    avgap avESgap avsolvency,ll(-1);
                 


 /* 3: Tab 5, col. 3 */;

                
                  xi:tobit growth FG STATIC DOMENTRY DG ageT ageT2 sales sales2 AS ES FORdirect intang gap ESgap 
                                    D89 solvency NO_FOR year94-year00 i.primaryu*trend reg1-reg4 reg6-reg8                                   
                                    konkurz liquidate both OUT_BR                                
                                    avFG avageT avageT2 avsales avsales2 avAS avES avFORdirect avintang 
                                    avgap avESgap avsolvency,ll(-1);
                 

           
 

#delimit cr
log close
end
